package cn.singno.springBoot.demo.ch04;

import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main
{
	@Test
	public void testname() throws Exception
	{
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScopeConfig.class);
		DemoSingletonService s1 = context.getBean(DemoSingletonService.class);
		DemoSingletonService s2 = context.getBean(DemoSingletonService.class);
		
		DemoPrototypeService p1 = context.getBean(DemoPrototypeService.class);
		DemoPrototypeService p2 = context.getBean(DemoPrototypeService.class);
		
		System.out.println("s1 与 s2 是否相等：" + s1.equals(s2));
		System.out.println("p1 与 p2 是否相等：" + p1.equals(p2));
		
		context.close();
	}
}
